﻿using Newtonsoft.Json;
using ServerBase.Client;
using ServerBase.Config;
using ServerBase.Other;
using ServerBase.Protocol;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UtilLib;
using UtilPublic.ApiDispatcher;
using UtilPublic.Serialization;
using static UtilPublic.Serialization.Jsh;

namespace ToolGame
{
    /// <summary>
    /// PageServer.xaml 的交互逻辑
    /// </summary>
    public partial class PageServer : Page
    {
        public PageServer()
        {
            InitializeComponent();

            MainWindow.绑定控制器(this);
        }

        private void Button_Click_Public(object sender, RoutedEventArgs e) { App.WdMain.Button_Click_Public(sender, e); }

        [ApiDpPubIA1((int)EGtAction.服务器信息)]
        public void 服务器信息(G2B_Gt_Action Rsp)
        {
            var GtArgs = Jsh.Jobj<CLS_GtServerInfo>(Rsp.GtArgs);

            BasePropMgr.GetFieldsDescList(GtArgs, out var ListDatas);
            DataGridServerInfoGet.BindingObj(ListDatas);
        }


        [ApiDpPubSA0("ButtonServerInfoGet")]
        public void OButtonServerInfoGet()
        {
            var Req = App.GetReq(EGtAction.服务器信息);
            App.ClientNetSingle.Send(Req);
        }
        [ApiDpPubSA0("ButtonServerSave")]
        public void OButtonServerSave()
        {
            var Req = App.GetReq(EGtAction.服务器存档);
            App.ClientNetSingle.Send(Req);
        }
        [ApiDpPubSA0("ButtonServerExit")]
        public void OButtonServerExit()
        {
            var Req = App.GetReq(EGtAction.服务器关闭);
            App.ClientNetSingle.Send(Req);
        }

        

    }
}
